/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DSENS;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.util.ArrayList;

/**
 *
 * @author teeteto
 */
class Sensor{
    public int ID;
    private int x;
    private int y;
    private int range;

    public Sensor(int id, int x, int y, int range) {
        this.ID = id;
        this.x = x;
        this.y = y;
        this.range = range;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }


    public int getRange() {
        return range;
    }

    public void setRange(int range) {
        this.range = range;
    }

    public void drawSensor(Graphics2D g){
        g.setColor(Color.BLACK);
        g.drawRect(this.x-1, this.y-1, 2, 2);
        if(this.ID==0) g.fill(new Rectangle(this.x-2, this.y-2, 8, 8));
        //if(this.ID==54) g.fill(new Rectangle(this.x-2, this.y-2, 8, 8));
        //if(this.ID==82) g.fill(new Rectangle(this.x-2, this.y-2, 8, 8));
        //g.drawOval(this.x-(int)(this.range),this.y-(int)(this.range), this.range*2, this.range*2);
    }



    public void drawConnection(Graphics2D g, ArrayList<Sensor> as, int[] ns, int d){
        int i=0;
        switch(d%5){
            case 0: g.setColor(Color.BLUE);
            case 1: g.setColor(Color.RED);
            case 2: g.setColor(Color.CYAN);
            case 3: g.setColor(Color.GREEN);
            case 4: g.setColor(Color.ORANGE);
        }
        while(i<ns.length){
            g.drawLine(this.x,this.y,as.get(ns[i]).getX(),as.get(ns[i]).getY());
            i++;
        }
    }
    public void drawConnection(Graphics2D g, ArrayList<Sensor> as, int[] ns){
        int i=0;
        g.setColor(Color.RED);
        while(i<ns.length){
            g.drawLine(this.x,this.y,as.get(ns[i]).getX(),as.get(ns[i]).getY());
            i++;
        }
    }


}
